<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>圣杯布局</title>
</head>

<body>
    <div class="container">
        <header class="bg">header</header>
        <div class="body">
            <main class="content bg">content</main>
            <nav class="nav bg">nav</nav>
            <aside class="ads bg">aside</aside>
        </div>
        <footer class="bg">footer</footer>
    </div>
    <style>
        .container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            text-align: center;
        }

        .body {
            display: flex;
            flex: 1;
        }

        header,
        footer {
            flex: 0 0 100px;
        }

        .content {
            flex: 1;
        }

        .ads,
        .nav {
            flex: 0 0 100px;
        }

        .nav {
            order: -1;
        }

        .bg {
            background: #eee;
            margin: 10px;
        }

        @media (max-width: 768px) {
            .body {
                flex-direction: column;
                flex: 1;
            }

            .nav,
            .ads,
            .content {
                flex: auto;
            }
        }
    </style>
</body>

</html>